package gameobjects.towers
{
	import assets.Globals;
	
	import flash.events.TimerEvent;
	
	import gameobjects.Projectile;
	import gameobjects.Tower;
	import gameobjects.TowerProjectile;
	import gameobjects.TowerProjectileTwo;
	
	import managers.SoundManager;

	public class Cannon extends Tower
	{
		private var myMovie:Tower2 = new Tower2();
		
		public function Cannon()
		{
			super(0.55);
			mySprite.addChild(myMovie);
			mySprite.x = -18;
			mySprite.y = -60;
			myMovie.walk();
		}
		
		override protected function timerHandler(event:TimerEvent):void
		{
			var projectile:Projectile = new TowerProjectileTwo(80);
			projectile.x = x+46;
			projectile.y = y + 15;
			Globals.game.addChild(projectile);
			SoundManager.gunerShoot();
			myMovie.die();
		}
		
		override public function pause():void
		{
			super.pause();
			myMovie.stop();
		}
		
		override public function resume():void
		{
			super.resume();
			myMovie.play();
		}
		
		override public function destroy():void
		{
			super.destroy();
			myMovie.dead();
		}
		
		public static function getPrice():int
		{
			return 5;
		}
	}
}